use crate::controller::auth::AuthController;
use crate::controller::candidate_path::CandidatePathController;
use crate::controller::candidate_path_segment_list::CandidatePathSegmentListController;
use crate::controller::endpoint_srv6_config::EndpointSrv6ConfigController;
use crate::controller::network_acl::NetworkAclController;
use crate::controller::network_acl_rule::NetworkAclRuleController;
use crate::controller::segment_list::SegmentListController;
use crate::controller::te_policy_group::TePolicyGroupController;
use crate::controller::traffic_steering_rule::TrafficSteeringRuleController;
use crate::controller::{
    endpoint::EndpointController, endpoint_peer::EndpointPeerController,
    endpoint_peer_wireguard_config::EndpointPeerWireguardConfigController,
    endpoint_wireguard_config::EndpointWireguardConfigController,
};
use crate::mq;
use crate::service::ServiceSet;
use std::sync::Arc;

pub struct ControllerSet {
    pub auth: Arc<AuthController>,
    pub endpoint: Arc<EndpointController>,
    pub endpoint_srv6_config: Arc<EndpointSrv6ConfigController>,
    pub endpoint_wireguard_config: Arc<EndpointWireguardConfigController>,
    pub endpoint_peer: Arc<EndpointPeerController>,
    pub endpoint_peer_wireguard_config: Arc<EndpointPeerWireguardConfigController>,
    pub te_policy_group: Arc<TePolicyGroupController>,
    pub candidate_path: Arc<CandidatePathController>,
    pub candidate_path_segment_list: Arc<CandidatePathSegmentListController>,
    pub segment_list: Arc<SegmentListController>,
    pub network_acl: Arc<NetworkAclController>,
    pub network_acl_rule: Arc<NetworkAclRuleController>,
    pub traffic_steering_rule: Arc<TrafficSteeringRuleController>,
}

impl ControllerSet {
    pub fn new(service_set: Arc<ServiceSet>, mq_client_set: Arc<mq::client::ClientSet>) -> Self {
        Self {
            auth: Arc::new(AuthController::new(service_set.clone())),
            endpoint: Arc::new(EndpointController::new(
                service_set.clone(),
                mq_client_set.clone(),
            )),
            endpoint_srv6_config: Arc::new(EndpointSrv6ConfigController::new(
                service_set.clone(),
                mq_client_set.clone(),
            )),
            endpoint_wireguard_config: Arc::new(EndpointWireguardConfigController::new(
                service_set.clone(),
                mq_client_set.clone(),
            )),
            endpoint_peer: Arc::new(EndpointPeerController::new(
                service_set.clone(),
                mq_client_set.clone(),
            )),
            endpoint_peer_wireguard_config: Arc::new(EndpointPeerWireguardConfigController::new(
                service_set.clone(),
                mq_client_set.clone(),
            )),
            te_policy_group: Arc::new(TePolicyGroupController::new(service_set.clone())),
            candidate_path: Arc::new(CandidatePathController::new(
                service_set.clone(),
                mq_client_set.clone(),
            )),
            candidate_path_segment_list: Arc::new(CandidatePathSegmentListController::new(
                service_set.clone(),
                mq_client_set.clone(),
            )),
            segment_list: Arc::new(SegmentListController::new(service_set.clone())),
            network_acl: Arc::new(NetworkAclController::new(service_set.clone())),
            network_acl_rule: Arc::new(NetworkAclRuleController::new(
                service_set.clone(),
                mq_client_set.clone(),
            )),
            traffic_steering_rule: Arc::new(TrafficSteeringRuleController::new(
                service_set,
                mq_client_set,
            )),
        }
    }
}
